<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/topLess.jsp"%>

<script>document.title="报表审核";</script>
<script src="${baseURL}/static/js/My97DatePicker/WdatePicker.js"></script>
<!-- ligerUI 插件 -->
<link href="${baseURL}/static/js/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${baseURL}/static/js/ligerUI/skins/Gray2014/css/all.css" rel="stylesheet" type="text/css" />
<script src="${baseURL}/static/js/ligerUI/js/ligerui.min.js"></script>
 <link href="${baseURL}/static/css/report.css" rel="stylesheet" type="text/css" media="screen" />
<c:set var="userAreaId" value="${sessionScope.user.userAreaId}"></c:set>
<c:set var="pid" value="${requestScope.areasMap[sessionScope.user.userAreaId].parentId}"></c:set>

<style type="text/css">
<!--
table {
	margin:0;
	width:auto;
	font-family:"微软雅黑";
	font-size:12px;
	color: #FFF;
	border-collapse: collapse;
}
//-->
</style>

<table id="search_t" style="width:98%">
		<tbody>
			<tr>
				<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png" align="middle">&nbsp;报表审核
				</th>
			</tr>
		
		</tbody>
</table>

<div id="nodata">
	<b>没有符合条件的记录。</b>
</div>
<br>
<div id="data">
<div id="dataList">
</div>
<div id="comment" class="row" align="center" style="display:none">
					<table id="remark-table" width="100%" border="0">
							<tr>
					          
					        	<td>
					           	审核意见：
					        	</td>
					       </tr>
					       <tr>
					           <td>
					           <textarea id="checkComment" name="checkComment"></textarea>
					           	
					           </td>
					       </tr>
					        <tr>
					          <td align="center" colspan="2">
								<input type="submit" name="saveAuditPassButton" class="button_01_lef" value="审核通过" onclick="check_box(5);"/>
									<input type="submit" name="saveAuditRejectButton" class="button_01_lef" value="审核驳回" onclick="check_box(3);"/>
							   </td>
							   </tr>
							   </table>
							   </div>

</div>
<script language="javaScript">
	$().ready(function(){
		var url = "${baseURL}/audit/mutiVerify";
		var data = "checkStatus=${checkStatus}&reporTypeId=${reporTypeId}&startingReportDate=${startingReportDate}&endingReportDate=${endingReportDate}&flag=${flag}&newTypeId=${newTypeId}&year=${year}";

		var loadi;
		$.ajax({
			url: url,
			type: 'post',
			data: data,
			dataType: 'json',
			beforeSend: function(){
				loadi = layer.load('加载中…');
			},
			complete: function(){
				layer.close(loadi);
			},
			success: function(msg){
				layer.close(loadi);
				if (msg.code==500){
					$("#nodata").css("display", "");
					$("#data").css("display", "none");
					layer.msg("查询失败", 1);
					return;
				}else{
					$("#nodata").css("display", "none");
					$("#data").css("display", "");
				}
				if(!msg.head)
					{
					$("#nodata").css("display", "");
					$("#data").css("display", "none");
					}
				if("${flag}"=='1')
					$("#comment").css("display", "none");
				else
					$("#comment").css("display", "");
				var colnames = [];
				$.each(msg.head, function(i, head){
					if("${flag}"=='1'&&head=='选择审核')
						{}
					else{
					if(i == 1){
						colnames.push({ id : head,
							name : head,display:head,
							width:120,
							render:function(item,index){
								if(item.选择审核){
									return "<input type='checkbox' name='ck' value='"+item.reportId+"'/>";
								}
							}
						});
					}else{
						colnames.push({ id : head,name : head,display:head,width:120});
					}
					}
				});
				ligergrid =  $("#dataList").ligerGrid({
					columns:colnames,
		            width: '100%', height: '90%', 
		           //checkbox : true,
		            alternatingRow: false,
                    usePager : false,
                   // groupColumnName : '地区名称',
					tree: { columnId: '地区名称' }
		        });
				ligergrid.set('data', strToJson(msg.queryResult));  
			}
		});	
			
	});

	function strToJson(str){ 
		var json = eval('(' + str + ')'); 
		return json; 
		}
	
	function check_box(ck){
		if (jQuery("input[name='ck']:checked").length < 1)
		{
			alert("请选择要审核的报表。");
			return;
		}
		var common=$("#checkComment").val();
		if(ck==3&&common=="")
		{
				alert("请填写审核意见。");
				return;	
		}
		var ids="";
		  var checkboxa = jQuery("input[name='ck']:checked").each(function(){
			  ids+=jQuery(this).val()+",";
		 });
		  var url = "${baseURL}/report/submit";
			var data = "checkStatus="+ck+"&ids="+ids+"&common="+common;

			var loadi;
			$.ajax({
				url: url,
				type: 'post',
				data: data,
				dataType: 'json',
				beforeSend: function(){
					loadi = layer.load('审核中…');
				},
				complete: function(){
					layer.close(loadi);
				},
				success: function(msg){
					 closeWin(msg.message);
				}
			});	
			
		}    
</script>

<%@ include file="/static/include/bottom.jsp"%>